
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>李宁体育</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="<%=path%>/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="<%=path%>/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="<%=path%>/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="<%=path%>/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="<%=path%>/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="<%=path%>/css/plugins/ionRangeSlider/ion.rangeSlider.css" rel="stylesheet">
    <link href="<%=path%>/css/plugins/ionRangeSlider/ion.rangeSlider.skinFlat.css" rel="stylesheet">
    <link href="<%=path%>/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"
          rel="stylesheet">
    <link href="<%=path%>/css/animate.min.css" rel="stylesheet">
    <link href="<%=path%>/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    
    <script src="<%=path%>/tinyeditor/packed.js"></script>
    <script src="<%=path%>/tinyeditor/tinyeditor.js"></script>
    <link href="<%=path%>/tinyeditor/style.css" rel="stylesheet">
    <style type="text/css">
    	.te {
    		margin:0;
    		overflow:hidden;
    	}
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>新增报名</h5>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" action="saveEnrrollVipActivity.do" method="post" id="enrrollVipActivityForm" enctype="multipart/form-data">
                        <div class="form-group">
									<div class="form-group">
									    <label class="col-sm-2 control-label">活动标题</label><font color="red">*</font>
									    <div class="col-sm-3">
											<input type="text" class="form-control" name="title" id="title" maxlength="12" placeholder="活动名称(不少于5个字符)"></input>
									    </div>
									</div>
									<div class="form-group">
									    <label class="col-sm-2 control-label">活动地址</label><font color="red">*</font>
									    <div class="col-sm-3">
											<input type="text" class="form-control" name="address" id="address" placeholder="活动地址"></input>
									    </div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">活动时间</label><font color="red">*</font>
										<div class="col-sm-3">
											<input type="text" class="form-control" name="beginTime" id="beginTime" placeholder="开始时间"></input>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label"></label><font color="red">*</font>
										<div class="col-sm-3">
											<input type="text" class="form-control" name="endTime" id="endTime" placeholder="结束时间"></input>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">活动海报</label><font color="red">*</font>
										<div class="col-sm-3">
										    <input id="picture" name="picture"   type="file"  maxlength="128" title="图片" placeholder="图片" onchange="validateImg();"/>
										    <span id="imgHint" style="color:red">图片比例1:1，建议尺寸120x120px</span>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">活动人数</label>
										<div class="col-sm-3">
											<input type="text" class="form-control" name="joinNum" id="joinNum" placeholder="人数"></input>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">详细内容</label>
										<div class="col-sm-3">
										    <!-- <textarea class="form-control" cols="20" id="description" name="description" placeholder="详细内容" rows="4"></textarea> -->
										    <textarea id="description" style="width:240px; height:150px" name="description"></textarea>	
										</div>
									</div>																
									<div class="form-group">
                                         <div class="col-sm-4 col-sm-offset-3">
                                          <button class="btn btn-primary" type="submit" onclick="editor.post();">保  存</button>
                                          &nbsp;<button class="btn btn-info" type="button" onclick="goBackVipActivity()">返  回</button>
                                         </div>
                                    </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="<%=path%>/js/jquery.min.js?v=2.1.4"></script>
<script src="<%=path%>/js/bootstrapValidator.min.js"></script>
<!--下拉框-->
<script src="<%=path%>/js/plugins/chosen/chosen.jquery.js"></script>
<!--时间选择-->
<script src="<%=path%>/js/plugins/layer/laydate/laydate.js"></script>
<script>
function validateImg(){
	   var img = $("#picture").val().toLowerCase().split('.');
	   if(img == ''){   
	   }else{
		   if (img[img.length - 1] == 'gif' || img[img.length - 1] == 'jpg'|| img[img.length - 1] == 'jpeg'|| img[img.length - 1] == 'png') {
			   
		   }else{
			   //$("#errImg").html("上传图片格式不对");
			   $("#picture").val("");
			   return false;
		   }  
	   }	  
 }
var editor = new TINY.editor.edit('editor',{
	id:'description', 
// (必须)上面第二步中定义的textarea的id
	width:584, 
// (选填) 编辑器宽度
	height:175,
 // (选填) 编辑器高度
	cssclass:'te',
 // (选填) 编辑器的class，用来通过css控制样式
	controlclass:'tecontrol',
 // (选填) 编辑器上按钮的class
	rowclass:'teheader',
 // (选填) 编辑器按钮行的class
	dividerclass:'tedivider', 
// (选填) 编辑器按钮间分割线的样式
	controls:['bold', 'italic', 'underline', 'strikethrough', '|', 'subscript', 'superscript', '|', 'orderedlist', 'unorderedlist', '|' ,'outdent' ,'indent', '|', 'leftalign', 'centeralign', 'rightalign', 'blockjustify', '|', 'unformat', '|', 'undo', 'redo', 'n', 'font', 'size', 'style', '|', 'image', 'hr', 'link', 'unlink', '|', 'cut', 'copy', 'paste', 'print'],
 // (必须) 要根据需要在编辑器上添加按钮控件, 其中'|'代表功能按钮间的竖分割线，'n'代表按钮行间的分割线
	footer:true, 
// (选填) 是否显示编辑器底部
	//fonts:['Verdana','Arial','Georgia','Trebuchet MS'],  
// (选填) 编辑器中可选择的字体
	xhtml:true, 
// (选填) 编辑器生成xhtml还是html标记
	cssfile:'style.css', 
// (选填) 要为编辑器附加的外部css文件
	content:'', 
// (选填) 设置编辑器编辑区域中的初始内容
	css:'body{background-color:#ccc}',
 // (选填) 设置编辑器编辑区域背景
	//bodyid:'editor', 
// (选填) 设置编辑区域ID
	footerclass:'tefooter', 
// (选填) 设置编辑器底部class
	// toggle:{text:'源代码',activetext:'可视化',cssclass:'toggle'},
 // (选填) 设置源代码浏览切换文字，及切换按钮的class
	resize:{cssclass:'resize'} 
// (选填) 设置编辑器大小调整按钮的class
});
    function goBackVipActivity() {
         window.location.href="<%=path%>/vipActivity/queryVipActivityList";
    }
	//表单验证
	var config = {
		".chosen-select" : {},
		".chosen-select-deselect" : {
			allow_single_deselect : !0
		},
		".chosen-select-no-single" : {
			disable_search_threshold : 10
		},
		".chosen-select-no-results" : {
			no_results_text : "Oops, nothing found!"
		},
		".chosen-select-width" : {
			width : "95%"
		}
	};

	for ( var selector in config)
		$(selector).chosen(config[selector]);
	$(document).ready(function() {
		$('#enrrollVipActivityForm').bootstrapValidator({
			message : 'This value is not valid',
			fields : {
				title : {
					message : '活动名称不能为空！',
					validators : {
						notEmpty : {
							message : '活动名称不能为空！'
						}
					}
				},
				address : {
					message : '活动地址不能为空！',
					validators : {
						notEmpty : {
							message : '活动地址不能为空！'
						}
					}
				},
				/* beginTime : {
					message : '请选择开始时间！',
					validators : {
						notEmpty : {
							message : '请选择开始时间！'
						}
					}
				},
				endTime : {
					message : '请选择结束时间！',
					validators : {
						notEmpty : {
							message : '请选择结束时间！'
						}
					}
				}, */
				picture : {
					message : '请上传活动海报！',
					validators : {
						notEmpty : {
							message : '请上传活动海报！'
						}
					}
				},
				joinNum : {
					message : '活动人数不能 为空！',
					validators : {
						notEmpty : {
							message : '活动人数不能 为空！'
						}
					}
				},
				/* description : {
					message : '详细内容不能为空！',
					validators : {
						notEmpty : {
							message : '详细内容不能为空！'
						}

					}
				}, */
			},
			submitHandler : function(validator, form, submitButton) {
			}
		});
	});
	
	//日期选择框
	var start = {
		elem : "#beginTime",
		format : "YYYY/MM/DD hh:mm:ss",
		max : "2099-06-16",
		istime : true,
		istoday : false,
		choose : function(datas) {
			end.min = datas;
			end.start = datas
		}
	};
	var end = {
		elem : "#endTime",
		format : "YYYY/MM/DD hh:mm:ss",
		min : laydate.now(),
		max : "2099-06-16",
		istime : true,
		istoday : false,
		choose : function(datas) {
			start.max = datas
		}
	};
	laydate(start);
	laydate(end);

	end.min = '${vipActivity.beginTime}';
	end.start = '${vipActivity.endTime}'
</script>
</body>
</html>
